"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UsersEntity = void 0;
const typeorm_1 = require("typeorm");
const moment_1 = __importDefault(require("moment"));
let UsersEntity = class UsersEntity {
    createDates() {
        this.created_at = (0, moment_1.default)().format("YYYY-MM-DD HH:mm:ss");
    }
    updateDates() {
        this.updated_at = (0, moment_1.default)().format("YYYY-MM-DD HH:mm:ss");
    }
};
exports.UsersEntity = UsersEntity;
__decorate([
    (0, typeorm_1.PrimaryGeneratedColumn)()
], UsersEntity.prototype, "id", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: "varchar",
        length: 30,
        nullable: false,
        unique: true,
    })
], UsersEntity.prototype, "username", void 0);
__decorate([
    (0, typeorm_1.Column)({
        type: "varchar",
        name: "password",
        length: 100,
        nullable: false,
        select: false,
        comment: "密码",
    })
], UsersEntity.prototype, "password", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "varchar", nullable: true })
], UsersEntity.prototype, "created_at", void 0);
__decorate([
    (0, typeorm_1.Column)({ type: "varchar", nullable: true })
], UsersEntity.prototype, "updated_at", void 0);
__decorate([
    (0, typeorm_1.BeforeInsert)()
], UsersEntity.prototype, "createDates", null);
__decorate([
    (0, typeorm_1.BeforeUpdate)()
], UsersEntity.prototype, "updateDates", null);
exports.UsersEntity = UsersEntity = __decorate([
    (0, typeorm_1.Entity)({ name: "user" })
], UsersEntity);
